/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */
package space.game.config;

import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.io.File;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.Mixer.Info;
import net.java.games.input.Controller;

/**
 * This class holds every selected information of this dialog box.
 * It is used as a return value
 */
public class CfgResult {

    private final GraphicsDevice gfxDevice;
    private final DisplayMode gfxMode;
    private final boolean gfxFullScreen;
    private final Mixer.Info sfxMixer;
    private final Controller ctrlDevice;
    private final boolean cfgShowPanel;
    private final File recordFile;

    public CfgResult(GraphicsDevice gfxDevice, DisplayMode gfxMode, boolean gfxFullScreen,
            Info mixerInfo, Controller ctrlDevice, boolean cfgShowPanel, File recordFile) {
        this.gfxDevice = gfxDevice;
        this.gfxMode = gfxMode;
        this.gfxFullScreen = gfxFullScreen;
        this.sfxMixer = mixerInfo;
        this.ctrlDevice = ctrlDevice;
        this.cfgShowPanel = cfgShowPanel;
        this.recordFile = recordFile;
    }

    public Controller getCtrlDevice() {
        return ctrlDevice;
    }

    public GraphicsDevice getGfxDevice() {
        return gfxDevice;
    }

    public boolean isGfxFullScreen() {
        return gfxFullScreen;
    }

    public DisplayMode getGfxMode() {
        return gfxMode;
    }

    public Info getSfxMixer() {
        return sfxMixer;
    }

    public File getRecordFile() {
        return recordFile;
    }

    public boolean isCfgShowPanel() {
        return cfgShowPanel;
    }

    public boolean isComplete() {
        return gfxDevice != null
                && gfxMode != null
                && sfxMixer != null
                && ctrlDevice != null;
    }

    CfgPreference buildPreferences() {
        return new CfgPreference(
                gfxDevice,
                gfxMode,
                gfxFullScreen,
                sfxMixer,
                ctrlDevice,
                cfgShowPanel);
    }
}
